/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package AplicacionMVC;


import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.GridBagLayout;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.WindowConstants;

/**
 *
 * @author Jesus Ruiz Oliva
 */
public class Inicio {
   static private GraphicsEnvironment ge =GraphicsEnvironment.getLocalGraphicsEnvironment();
   static private GraphicsDevice gd = null;

    public static void main (String[] arg) throws SQLException{
        try {
            UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(Inicio.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            Logger.getLogger(Inicio.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(Inicio.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedLookAndFeelException ex) {
            Logger.getLogger(Inicio.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        BaseDatos bd = new BaseDatos();
        bd.conectar();
        HebraLectoraBd reader = new HebraLectoraBd(bd);
        JFrame frame= new JFrame("Gestion Automatica de Email");
        JPanel conteiner = new JPanel();
        conteiner.setLayout(new GridBagLayout());
        
        Vistas panel = new Vistas();
        
        conteiner.add(panel);
        frame.add(conteiner);
        frame.pack();
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);        
        frame.setSize(1200, 800);
        frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
        //gd = ge.getDefaultScreenDevice();
        //gd.setFullScreenWindow(frame);
        frame.setVisible(true);
        
        //creamos el objeto controlador de eventos
        Controller control= new Controller(panel,reader);
        panel.addButtonListener(control);
    }    
}